package com.cykj.controller;

import com.cykj.dto.ResponseDto;
import com.cykj.pojo.PsTopic;
import com.cykj.service.TypeService;
import com.cykj.vo.PsTopicVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @BelongsProject: Psychology
 * @BelongsPackage: com.cykj.controller
 * @Author: 小林
 * @CreateTime: 2025-02-04 20:39
 * @Description: 领域表控制层
 * @Version: 1.0
 */
@RestController
@RequestMapping("/type")
public class TypeController {
    @Autowired
    private TypeService typeService;

    /**
     * 根据id去查询该领域下面对应的题目
     * @param
     * @return
     */
    @RequestMapping("/getTopicsByTypeId")
    public ResponseDto getTopicsByTypeId(@RequestBody PsTopicVo vo){
        return typeService.getTopicsByTypeId(vo);
    }

    /**
     * 查询所有领域
     * @return
     */
    @RequestMapping("/getAll")
    public ResponseDto getAll(){
        return typeService.getAllTypes();
    }

    /**
     * 删除题目
     * @param
     * @return
     */
    @RequestMapping("/delete")
    public ResponseDto deleteTopicByTopicId(@RequestBody PsTopicVo vo) {
        return typeService.deleteTopicByTopicId(vo);
    }

    /**插入新记录
     *
     * @param vo
     * @return
     */
    @RequestMapping("/insertTopic")
    public ResponseDto insertTopic(@RequestBody PsTopicVo vo) {
        return typeService.insertTopic(vo);
    }

    /**
     * 修改题目
     * @param vo
     * @return
     */
    @RequestMapping("/updateTopic")
    public ResponseDto updateTopic(@RequestBody PsTopicVo vo) {
        return typeService.updateTopic(vo);
    }

    /**
     * 获取全部题目
     * @param pageNum
     * @param pageSize
     * @return
     */
    @RequestMapping("/getTopicAll")
    public ResponseDto getTopicAll( Integer pageNum,Integer pageSize) {
        return typeService.getAll(pageNum, pageSize);
    }
}

